import {createApp} from 'vue'
import App from './App.vue'
import router from '@/router'
import {setupStore} from '@/store'
import {setupDirective} from '@/directive'
import * as OneCodeVue from 'one-code-vue'
import _ from 'lodash'
import {SystemExtend} from "@/SystemExtend";

// import '@/permission'

// 样式
// import "element-plus/dist/index.css"
// import "element-plus/theme-chalk/dark/css-vars.css"
import 'one-code-vue/dist/style.css'
import '@/styles/index.scss'
import './styles/project.css'

const app = createApp(App);

// 全局注册 自定义指令(directive)
setupDirective(app);

// 全局注册 状态管理(store)
setupStore(app);

function main() {
    window['_'] = _
    window['system'] = new SystemExtend()

    import('@/lang/index').then(i18n => {
        app.use(router).use(i18n['default']).use(OneCodeVue)
        if (import.meta.env.VITE_APP_STUDIO_ENABLE === 'true') {
            OneCodeVue.installStudio(app, router)
        }
        app.mount('#app');
    })
}

main()
